package com.example.spi.autoconfigure;

import com.example.spi.ModuleService;
import com.example.spi.SpiServiceManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ServiceLoader;

@Configuration
public class SpiAutoConfiguration {
    @Bean
    public SpiServiceManager spiServiceManager() {
        return new SpiServiceManager();
    }

    // 可选：直接将所有SPI服务注册为Spring Bean
    @Bean
    public ServiceLoader<ModuleService> moduleServiceLoader() {
        return ServiceLoader.load(ModuleService.class);
    }
}